<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!doctype html>
<html lang="en">
<c:if test="${username==null}">
<%out.print("<script>alert('您还没有登录，请登录...'); window.location='login.jsp'</script>");%>
</c:if>
<c:if test="${list.isEmpty()}">
<%out.print("<script>alert('您的购物车为空！请先添加商品...');window.location='index.jsp'</script>"); %>
</c:if>
<head>
    <meta charset="UTF-8">
    <title>蔚蓝网首页</title>
    <link href="css/global.css" rel="stylesheet"/>
    <link href="css/layout.css" rel="stylesheet"/>
    <link href="css/template.css" rel="stylesheet" />
</head>
<style>
.price_input{width: 15px;text-align: center;}
.tr_title td{background-color:pink;margin: 0;}
.shoppingcar{width: 1000px;border-bottom: 1px solid red;}
</style>
<script type="text/javascript" src="js/jquery-1.12.4.js"></script>
<script type="text/javascript">
$(function(){
	var num=$(".price_input").val();
	var bookpress=$(".bookpress").html();
	$("#minus").click(function(){
		num--;
		if(num<1){
			alert("数量不符合规范!");
			num=1;
		}
		$(".price_input").val(num);
		$(".price_count").html(num*bookpress);
	 });
	$("#add").click(function(){
		num++;
		$(".price_input").val(num);
		$(".price_count").html(num*bookpress);
	})
	

})



</script>
<body>
<!--随滚动条滚动可关闭广告-->
<div id="right" class="right">
    <div class="dd_close" id="dd_close"><a href="javascript:void(0);">关闭</a></div>
    <img src="images/scroll.jpg" id="right1" />
</div>
<!--头部-->
<header id="header">
    <div class="header_top">
        <div class="header_top_left">您好!${username}欢迎光临蔚蓝网 [<a href="login.jsp" target="_parent">注销</a> | <a href="register.html" target="_parent">免费注册</a>]</div>
        <div class="header_top_right">
            <ul>
                <li><a href="#" target="_self">客户服务</a></li>
                <li>|</li>
                <li id="menu"><a href="#" target="_self">新手入门</a> <img src="images/arrow_down.gif" alt="arrow" />
                    <div id="dd_menu_top_down">
                        <a href="#" target="_self">购物保障</a><br />
                        <a href="#" target="_self">购物流程</a><br />
                        <a href="#" target="_self">会员介绍</a><br />
                        <a href="#" target="_self">常见问题</a><br />
                    </div>
                </li>
                <li>|</li>
                <li><a href="#" target="_self">礼品卡</a></li>
                <li>|</li>
                <li><a href="#" target="_self">我的订单</a></li>
                <li>|</li>
                <li><a href="#" target="_self">我的账户</a></li>
                <li>|</li>
                <li><a href="BookServlet?action=shoppingcar&username=${username}" target="_parent">购物车</a></li>
                <li><img src="images/header_shop.gif" alt="shopping"/></li>
            </ul>
        </div>
    </div>
</header>
<div class="header_middle">
    <div class="logo"><img src="images/logo.png" alt="logo"/></div>
    <div class="search"><input type="text" placeholder="请输入搜索关键字"><input type="button"></div>
</div>

<!--网站中间内容开始-->

<section id="main">
              <table class="shoppingcar">
                     <tr class="tr_title">
                         <td>商品信息</td><td>单价</td><td>操作</td><td>数量</td><td>总计</td>
                     </tr>
                     
                     
                     
                     <c:forEach var="i" items="${list}">
                         <tr class="tr_book">
                             <td><img src="${i.imgsrc}"></td>
                             <td class="bookpress">${i.bookpress}</td>
                             <td><a href="BookServlet?action=delbook&bid=${i.bid}">移除</a></td>
                             <td>
                            <input id="minus" type="button" value="-" style="font-size: 25px;" />
                             <input  type="text" class="price_input" value="3">
                             <input id="add" type="button" value="+" style="font-size: 25px;" />
                             </td>
                             <td><span class="price_count"></span><span>元</span></td>
                         </tr>
                     </c:forEach>
                            
                            
                         

                     
              </table>
   
    



<!--网站版权部分开始-->
<footer id="footer">
    <div class="footer_top"><a href="#" target="_parent" class="footer_dull_red">正版保障</a> | <a href="#" target="_parent" class="footer_dull_red">满额免运</a> | <a href="#" target="_parent" class="footer_dull_red">货到付款</a> | <a href="#" target="_parent" class="footer_dull_red">品种最全</a> | <a href="#" target="_parent" class="footer_dull_red">免费退换</a></div>
    <div class="footer_end">Copyright (C) 蔚蓝网 2006-2016, All Rights Reserved  <img src="images/validate.gif"  alt="版权" style="vertical-align:middle;" /> 京ICP证100488号 出版物经营许可证 京批100160号</div>
</footer>
<script  src="js/jquery-1.12.4.js"></script>
<script src="js/index.js"></script>
<script src="js/header.js"></script>
</body>
</html>

